package com.zznj.xzjc.fragment;

import android.os.Bundle;
import android.view.View;

import com.google.gson.Gson;
import com.vondear.rxtool.RxActivityTool;
import com.vondear.rxui.fragment.NewLazyFragment;
import com.zznj.xzjc.R;
import com.zznj.xzjc.activity.ActivityAjcxMain;
import com.zznj.xzjc.activity.ActivityAlk;
import com.zznj.xzjc.activity.ActivityHdlxMain;
import com.zznj.xzjc.activity.ActivityJcjy;
import com.zznj.xzjc.activity.ActivityLcjd;
import com.zznj.xzjc.activity.ActivityXsglDetail;
import com.zznj.xzjc.activity.ActivityXsglMain;
import com.zznj.xzjc.activity.ActivityZnyjMain;
import com.zznj.xzjc.activity.index.ActivityZtgkMain;
import com.zznj.xzjc.activity.index.IndexWebActivity;
import com.zznj.xzjc.activity.index.work.IndexWorkActivity;
import com.zznj.xzjc.net.SharedHelper;
import com.zznj.xzjc.net.entity.LoginBean;
import com.zznj.xzjc.net.rxjava.HttpMethods;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class MainFragment extends NewLazyFragment {
    Unbinder unbinder;

    @BindView(R.id.jrdwBtn)
    View jrdwBtn;
    @BindView(R.id.ajblBtn)
    View ajblBtn;
    @BindView(R.id.jdzxBtn)
    View jdzxBtn;
    @BindView(R.id.lcjkBtn)
    View lcjkBtn;
    @BindView(R.id.znyjBtn)
    View znyjBtn;
    @BindView(R.id.jcjyBtn)
    View jcjyBtn;
    @BindView(R.id.ajcxBtn)
    View ajcxBtn;
    @BindView(R.id.tjfxBtn)
    View tjfxBtn;
    @BindView(R.id.hdlxBtn)
    View hdlxBtn;
    @BindView(R.id.alkBtn)
    View alkBtn;
    @BindView(R.id.xsglBtn)
    View xsglBtn;


    @Override
    protected int getContentViewId() {
        return R.layout.gyss_fragment_main_layout;
    }

    @Override
    protected void initView(View view) {
        unbinder = ButterKnife.bind(this, view);
        super.initView(view);
    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.jrdwBtn, R.id.ajblBtn, R.id.jdzxBtn, R.id.lcjkBtn, R.id.znyjBtn, R.id.jcjyBtn, R.id.ajcxBtn, R.id.tjfxBtn, R.id.hdlxBtn, R.id.alkBtn, R.id.xsglBtn})
    public void onClick(View v) {
        Bundle bundle = new Bundle();
        if (v.getId() == R.id.jrdwBtn) {
            bundle.putInt("selectIndex", 0);
            RxActivityTool.skipActivity(mContext, ActivityZtgkMain.class, bundle);
        } else if (v.getId() == R.id.ajblBtn) {
            bundle.putInt("selectIndex", 1);
            RxActivityTool.skipActivity(mContext, ActivityZtgkMain.class, bundle);
        } else if (v.getId() == R.id.jdzxBtn) {
            bundle.putInt("selectIndex", 2);
            RxActivityTool.skipActivity(mContext, ActivityZtgkMain.class, bundle);
        } else if (v.getId() == R.id.lcjkBtn) {
            RxActivityTool.skipActivity(mContext, ActivityLcjd.class);
        } else if (v.getId() == R.id.znyjBtn) {
            RxActivityTool.skipActivity(mContext, ActivityZnyjMain.class);
        } else if (v.getId() == R.id.jcjyBtn) {
            RxActivityTool.skipActivity(mContext, ActivityJcjy.class);
        } else if (v.getId() == R.id.ajcxBtn) {
            RxActivityTool.skipActivity(mContext, ActivityAjcxMain.class);
        } else if (v.getId() == R.id.tjfxBtn) {
            LoginBean user = new Gson().fromJson(SharedHelper.readValueByKeyForString(mContext, "Member"), LoginBean.class);
            bundle.putString("path", HttpMethods.BASE_URL + "xzapi/caseAnalysis/getStatisticalAnalysis?userId=" + user.getUserId());
            bundle.putString("title", "统计分析");
            RxActivityTool.skipActivity(mContext, IndexWebActivity.class, bundle);
        } else if (v.getId() == R.id.hdlxBtn) {
            RxActivityTool.skipActivity(mContext, ActivityHdlxMain.class);
        } else if (v.getId() == R.id.alkBtn) {
            RxActivityTool.skipActivity(mContext, ActivityAlk.class);
        } else if (v.getId() == R.id.xsglBtn) {
            RxActivityTool.skipActivity(mContext, ActivityXsglMain.class);
        }
    }
}
